// index.js
document.getElementById('addBtn').addEventListener('click', addTask);
document.getElementById('taskInput').addEventListener('keypress', (e) => {
    if (e.key === 'Enter') addTask();
});

function addTask() {
    const input = document.getElementById('taskInput');
    if (input.value.trim() === '') return;
    
    const li = document.createElement('li');
    li.innerHTML = `
        <span>${input.value}</span>
        <div>
            <button class="complete">✓</button>
            <button class="delete">×</button>
        </div>
    `;
    
    li.querySelector('.complete').addEventListener('click', () => 
        li.querySelector('span').classList.toggle('completed'));
    li.querySelector('.delete').addEventListener('click', () => li.remove());
    
    document.getElementById('taskList').appendChild(li);
    input.value = '';
}